package Controller.CourseServlet;

import Dao.CourseDao;
import bean.Course;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/course_change")
public class course_change extends HttpServlet {
    CourseDao courseDao = new CourseDao();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String cno = req.getParameter("cno");
        Course course = courseDao.selectByCno(cno);
        System.out.println(course);
        req.setAttribute("course", course);
        req.getRequestDispatcher("CourseInfoChange.jsp").forward(req, resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
